<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Git上的免费的编程书籍</title>
  <link id="bts-style-link" rel="stylesheet" href="assets/lib/bootswatch/paper/bootstrap.min.css">
  <link id="code-style-link" rel="stylesheet" href="assets/lib/highlight/styles/github.css">
  <style>
    #book-list .book .thumbnail{
      height: 220px;
    }
    #book-list .media {
      border: 1px solid #eee;
      padding: 10px 5px;
    }
  </style>
  <script src="/books.js"></script>
</head>
<body>
  <nav class="navbar navbar-default">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-4" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="/">GIT Books</a>
      </div>
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-4">
        <p class="navbar-text">Some books from any git repo</p>
      </div>
    </div>
  </nav>
  <div class="container">
    <div class="page-header">
      <h1>Books<small>free programming books</small></h1>
    </div>

    <div class="row">
      <div id="book-list" class="col-xs-12 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
      </div>
    </div>
  </div>

  <div class="page-footer">
    <div class="container">
      <div class="row">
        <div class="col-xs-12">
          <div class="info-box">
            <div class="info-item">
              Project <a href="https://github.com/git-books/git-books.github.io" target="_blank"><i class="fa fa-github" aria-hidden="true"></i> Git-books</a>
            </div>
            <div class="info-item">
              Document site powered by <a href="https://github.com/inhere/md-site-reader" target="_blank"><i class="fa fa-github" aria-hidden="true"></i> inhere/md-site-reader</a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- end.page-footer -->

  <script src="/assets/lib/jquery-2.2.4.min.js"></script>
  <script type="text/javascript">
    $(function () {
      let booksHtml = ''

      $.each(books, function (index, book) {
        // console.log(index, book)
        booksHtml += `
        <div class="media">
          <div class="media-left"><a href="#"></a></div>
          <div class="media-body">
            <h4 class="media-heading"><i class="glyphicon glyphicon-book" aria-hidden="true"></i> ${book.name}</h4>
            <p>${book.description} ...</p>
            <div class="clearfix">
              <a href="${book.url}" class="btn btn-primary pull-right"> Read <i class="glyphicon glyphicon-chevron-right" aria-hidden="true"></i></a>
            </div>
          </div>
        </div>`
      })

      if (booksHtml) {
        $('#book-list').html(booksHtml)
      }
    })
  </script>
</body>
</html>
